<template>
  <div id="app">
    <h1>第{{times}}次请求</h1>
    <button @click="login">登录</button>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'App',
  data: function() {
    return {
      times: 0
    }
  },
  methods: {
    login(){
      axios.post('http://localhost:3000/login', {
      },{
        withCredentials: true  //打开cookie
      })
      .then((res) => {
        const { n } = res.data
        this.times = n;
      })
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  list-style: none;
}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  display: block;
  width: 200px;
  height: 100px;
  font-size: 60px;
  color: #2c3e50;
  margin: 150px auto;
}
</style>
